<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Auth extends CI_Controller {
	
	function __construct() {
		parent::__construct();
		$this->load->model('user_model','user');
	}
	
	function index(){
		$this->access->logout();
		$this->login();
	}
	
	function login(){
		$this->access->logout();
		$data['flash'] = $this->session->flashdata('error');
		$this->load->view('auth/login_form',$data);
	}
	
	function check_login(){
		$nim = trim($this->input->post('nim',TRUE));
		$pwd = trim($this->input->post('password',TRUE));
		
		if($this->access->login($nim,$pwd)){
			redirect(HOME);
		}else{
			$this->session->set_flashdata('error',TRUE);
			redirect(AUTH);
		}
	}
}
/** End of file */